const { defineConfig } = require('@vue/cli-service')

// let postcssPxtorem = require('postcss-pxtorem')({
//   rootValue: 54,//根元素字体大小
//   unitPrecision: 5, //允许rem单位增长的十进制数字
//   replace: true, //替换包含rems的规则，而不添加后备
//   mediaQuery: false, //允许在媒体查询中转换px
//   minPixelValue: 0, //设置要替换的最小像素值
//   selectorBlackList: [], //忽略转换正则匹配项
//   propList: ['*'], //可以从px转换为rem的属性，匹配正则
//   // exclude: /node_modules/i  //要忽略并保留为px的文件路径
// })

let postcssPxtorem = ''

module.exports = defineConfig(() => {
  return {
    transpileDependencies: true,
    lintOnSave: false,
    publicPath: "/",
    css: {
      loaderOptions: {
        postcss: {
          postcssOptions: {
            plugins: [
              postcssPxtorem,
            ]
          }
        }
      }
    },
    // 输出文件目录
    outputDir: process.env.outputDir,
    devServer: {
      client: {
        overlay: false,
      },
      port: 9999,
      proxy: {
        "^/api": {
          target: process.env.VUE_APP_API_URL,
          changeOrigin: true,
          pathRewrite: { "^/api": "" },
        },
      },
    },
  }

})
